#include "BloomFilter.h"

namespace fuh{
    void Test_Bloom()
    {
        srand(time(0));
        const size_t size = 1000000;
        string Sorstr = "baidu";
        Bloomfilter<size> bl;
        vector <string> arr;
        vector <string> Vtest;
        for(int i = 0;i<size;i++)
        {
            string s = Sorstr+to_string(i);
            bl.Set(s);
            arr.push_back(s);
        }
        for(int i = 0;i<size;i++)
        {
            string s = Sorstr+to_string(rand()%1000 +9999);
            Vtest.push_back(s);
        }
        size_t accuracy = 0;
        for(auto str:Vtest)
        {
            if(bl.test(str))
            {
                accuracy++;
            }
        }
        cout<<1.0*accuracy/size<<endl;
    }
};

// int main()
// {
//     fuh::Test_Bloom();
//     return 0;
// }